﻿//JumbotCms_4.1 Final
using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Jumbot.Common;
using JumbotCms.API;

namespace JumbotCms.WebFile.Admin.Cut2Thumb
{
    public partial class _upload : AdminCenter
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ChannelId = Str2Str(q("ccid"));
            Admin_Load("", "html", true);
            this.ThumbSize.Items.Clear();
            ListItem li;
            doh.Reset();
            doh.ConditionExpress = "id=@id";
            doh.AddConditionParameter("@id", ChannelId);
            string _defaultThumbs = doh.GetValue("jcms_normal_channel", "DefaultThumbs").ToString();
            doh.Reset();
            doh.SqlCmd = "SELECT ID,Title,iWidth,iHeight FROM [jcms_normal_thumbs] WHERE [ChannelId]=" + ChannelId + " OR [ChannelId]=0 ORDER BY ChannelID,ID";
            DataTable dtThumb = doh.GetDataTable();
            for (int i = 0; i < dtThumb.Rows.Count; i++)
            {
                li = new ListItem();
                li.Value = dtThumb.Rows[i]["iWidth"].ToString() + "|" + dtThumb.Rows[i]["iHeight"].ToString();
                li.Text = dtThumb.Rows[i]["Title"].ToString();
                if (_defaultThumbs == dtThumb.Rows[i]["ID"].ToString())
                    li.Selected = true;
                else
                    li.Selected = false;
                this.ThumbSize.Items.Add(li);
            }
            dtThumb.Clear();
            dtThumb.Dispose();
        }
    }
}
